package com.example.edittext;

import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

    private EditText mEtAccount , mEtPassword;
    private androidx.appcompat.widget.AppCompatButton mBtnLogin;
    private TextView mTvInfo;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        initView();

        mBtnLogin.setOnClickListener(v ->
        {
            String account = mEtAccount.getText().toString().trim();
            String password = mEtPassword.getText().toString().trim();
            mTvInfo.setText( account + password);
        });
    }

    private void initView() {
        mEtAccount = findViewById(R.id.account);
        mEtPassword = findViewById(R.id.password);
        mBtnLogin = findViewById(R.id.btn_login);
        mTvInfo = findViewById(R.id.tv_Info);
    }
}